package org.wmq.taskschedule.factory;

import org.springframework.beans.BeanUtils;
import org.wmq.taskschedule.algorithm.AlgorithmExecutor;
import org.wmq.taskschedule.algorithm.SobelEdgeDetector;
import org.wmq.taskschedule.biz.model.DO.Param;

/**
 * Sobel边缘检测算法执行器工厂类
 * 实现AlgorithmExecutorFactory接口，用于创建SobelEdgeDetector实例
 */
public class SobelEdgeDetectorFactory implements AlgorithmExecutorFactory {
    private static final SobelEdgeDetectorFactory instance = new SobelEdgeDetectorFactory();

    private SobelEdgeDetectorFactory() {}
    
    /**
     * 获取工厂实例
     * @return SobelEdgeDetectorFactory实例
     */
    public static SobelEdgeDetectorFactory getInstance() {
        return instance;
    }
    
    @Override
    public AlgorithmExecutor getAlgorithmExecutor(Param param) {
        SobelEdgeDetector sobelEdgeDetector = new SobelEdgeDetector();
        BeanUtils.copyProperties(param, sobelEdgeDetector);
        return sobelEdgeDetector;
    }
}